home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / disktime.zip / RECAL.PAS < prev    next >
Pascal/Delphi Source File  |  1985-11-03  |  1KB  |  55 lines

  1. Procedure Recalibrate(Var Drive,CylMax:Integer);
  2. {
  3.     This procedure recalibrates the specified hard disk drive
  4.  
  5.     Input        Integer specifying drive to reset
  6.  
  7.                  CylMax is ignored
  8.  
  9.     Output       None
  10.  
  11.     Strategy     (1)     Request bios to reset specified drive
  12.  
  13.                  (2)     Print message to pacify user
  14.  
  15.                  (3)     Request bios to recalibrate the drive
  16. }
  17. Type
  18.     Result=Record
  19.                  Ax,Bx,Cx,Dx,Bp,Si,Di,Ds,Es,Flags:Integer;
  20.     End;
  21. Var
  22.     Sys:Result;
  23. Begin
  24.     SYS.AX:=$0D*$0100+$01       { AH=0Dh means reset the hard disk };
  25.     SYS.CX:=$00*$0100+$01       { CH=Cylinder, CL=Sector };
  26.     SYS.DX:=$00*$0100+$80+Drive { DH=Head, DL=$80+Drive };
  27.     Intr($13,Sys);
  28.  
  29.     If Odd(Sys.Flags) then
  30.        Begin
  31.             Writeln;
  32.             Writeln;
  33.             NormVideo;
  34.             Writeln('Error from drive ',Drive,' reset');
  35.             Halt;
  36.        End;
  37.  
  38.     Write('Recalibrating...');
  39.  
  40.     SYS.AX:=$11*$0100+$01       { AH=11h means recalibrate, AL=Sector };
  41.     SYS.CX:=$00*$0100+$01       { CH=Cylinder, CL=Sector };
  42.     SYS.DX:=$00*$0100+$80+Drive { DH=Head, DL=$80+Drive };
  43.     Intr($13,Sys);
  44.  
  45.     Writeln;
  46.     Writeln;
  47.  
  48.     If Odd(Sys.Flags) Then
  49.        Begin;
  50.             NormVideo;
  51.             Writeln('Error recalibrating drive ',Drive);
  52.             Halt;
  53.        End;
  54.  
  55. End;